﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MINERP.SamllPicPrint.Presenter;

namespace MINERP.SamllPicPrint.Forms
{
    public partial class FrmMovePic : Form
    {
        public FrmMovePic()
        {
            InitializeComponent();
        }

        public int TotalPhotoNum { get; set; }//将要移动的照片总数

        private int _movePhotonum = 0;
        private int errPhotoNum = 0;
        private int MovePhotoInt { get { return _movePhotonum; } set { _movePhotonum++; lblCurMovePhotoNum.Text = _movePhotonum.ToString(); } }

        private void FrmMovePic_Load(object sender, EventArgs e)
        {
            MovePhotoInt = 0;
            lblTotalCount.Text = TotalPhotoNum.ToString();
            progressBar1.Maximum = TotalPhotoNum;
            MainPresenter.ShowMsgEvent += new MainPresenter.ShowMsg(MainPresenter_ShowMsgEvent);
        }

        void MainPresenter_ShowMsgEvent(string photoPath, bool isSus)
        {
            MovePhotoInt = 0;

            if (!isSus)
            {
                errPhotoNum++;
                label1.Text = "出错张数：" + errPhotoNum.ToString();
            }
            if (_movePhotonum > progressBar1.Maximum)
            {
                _movePhotonum = progressBar1.Maximum;
            }
            progressBar1.Value = _movePhotonum;
            listBoxControl1.Items.Insert(0, photoPath);
            lblCurMovePhotoNum.Text = _movePhotonum.ToString(); 
        }
    }
}
